import java.sql.*;
import oracle.jdbc.driver.*;
class TestJDBC
{
    String sQuery;
    TestJDBC()
    {
        this.sQuery="select nomEtudiant from Etudiant";
        Statement sStat=null;
        Connection cCon=null;
        try{
            Class cDriverOracle=Class.forName("oracle.jdbc.driver.OracleDriver");
            Driver dDriverOracle=(java.sql.Driver)cDriverOracle.newInstance();
            DriverManager.registerDriver(dDriverOracle);
            cCon=DriverManager.getConnection("jdbc:oracle:thin:@v240.ig.polytech.univ-montp2.fr:1521:ORA10","fabien.retif","oracle");
        }
        catch(Exception e)
        {
            System.out.println("--Pbm en chargeant le driver JDBC oracle--");
            e.printStackTrace();
        }
        try
        {
            sStat=cCon.createStatement();
            ResultSet rs=sStat.executeQuery(sQuery);
            while(rs.next())
            {
            System.out.println("Resultat requete: "+rs.getObject(1));
            }
            sStat.close();
        }
        catch(Exception sqlE)
        {
            System.out.println("La Requête n'a pas abouti");
            sqlE.printStackTrace();
        }
    }

    public static void main(String[] sArgs){
        TestJDBC tj=new TestJDBC();
    }
}